package com.lijian.community.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lijian.community.dto.QuestionQueryDTO;
import com.lijian.community.model.Question;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface QuestionMapper extends BaseMapper<Question> {
    /**
     * 创建问题
     */
    void createQuestion(Question question);

    List<Question> findAll();

    List<Question> findAllByUserId(@Param("userId") Integer userId);

    Integer countByUserId(@Param("userId") Integer userId);

    Question findById(Integer id);

    int updateQuestion(Question question);

    void updateView(Integer id);

    void updateComment(Integer id);

    List<Question> findRelated(Question question);

    Integer countBySearch(QuestionQueryDTO questionQueryDTO);

    List<Question> findBySearch(QuestionQueryDTO questionQueryDTO);
}
